package org.nepu.scr.indexrate.converter.compliancerate.operationreliability;

import cn.hutool.json.JSONUtil;
import org.nepu.scr.indexrate.vo.compliancerate.operationreliability.CirculationA112;

import javax.persistence.AttributeConverter;
import javax.persistence.Convert;

@Convert
public class CirculationA112Converter implements AttributeConverter<CirculationA112, String> {
    @Override
    public String convertToDatabaseColumn(CirculationA112 circulationA112) {
        return JSONUtil.toJsonStr(circulationA112);
    }

    @Override
    public CirculationA112 convertToEntityAttribute(String s) {
        return JSONUtil.toBean(s, CirculationA112.class);
    }
}
